package com.javacoo.xservice.base.setting;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 应用恶意请求拦截器相关配置
 * <p>说明:</p>
 * <li>对应application-*.properties中app.config.maliciousRequestInterceptor</li>
 * @author DuanYong
 * @since 2017年7月28日上午9:19:37
 */
@Configuration
@ConfigurationProperties(prefix = AppMaliciousRequestInterceptorSetting.PREFIX)
public class AppMaliciousRequestInterceptorSetting {
    public static final String PREFIX = "app.config.malicious";
    public static final String ENABLED = "enabled";
    /** 是否开启恶意请求拦截,默认值*/
    public static final Boolean DEFAULT_OPEN = false;
	/** 拦截所有请求,否则拦截相同请求,默认值*/
	public static final Boolean DEFAULT_ALLREQUEST = false;
	/** 允许的最小请求间隔(毫秒):,默认值*/
	public static final Integer DEFAULT_MIN_REQUEST_INTERVAL_TIME= 1000;
	/** 允许的最大恶意请求次数:,默认值*/
	public static final Integer DEFAULT_MAX_MALICIOUS_TIMES= 0;

    /** 是否开启恶意请求拦截:true->开启,false->关闭*/
    private Boolean open = DEFAULT_OPEN;
    /**是否开启恶意请求拦截*/
    private String enabled = ENABLED;
	/** 拦截所有请求,否则拦截相同请求*/
	private Boolean allRequest = DEFAULT_ALLREQUEST;
	/** 允许的最小请求间隔(毫秒)*/
	private Integer minRequestIntervalTime = DEFAULT_MIN_REQUEST_INTERVAL_TIME;
	/** 允许的最大恶意请求次数*/
	private Integer maxMaliciousTimes = DEFAULT_MAX_MALICIOUS_TIMES;

    public Boolean getOpen() {
        return open;
    }

    public void setOpen(Boolean open) {
        this.open = open;
    }

    public String getEnabled() {
        return enabled;
    }

    public void setEnabled(String enabled) {
        this.enabled = enabled;
    }

    public Boolean getAllRequest() {
		return allRequest;
	}
	public void setAllRequest(Boolean allRequest) {
		this.allRequest = allRequest;
	}
	public Integer getMinRequestIntervalTime() {
		return minRequestIntervalTime;
	}
	public void setMinRequestIntervalTime(Integer minRequestIntervalTime) {
		this.minRequestIntervalTime = minRequestIntervalTime;
	}
	public Integer getMaxMaliciousTimes() {
		return maxMaliciousTimes;
	}
	public void setMaxMaliciousTimes(Integer maxMaliciousTimes) {
		this.maxMaliciousTimes = maxMaliciousTimes;
	}
	
	
	
	
}
